var index;

$(function(){
	index = parent.layer.getFrameIndex(window.name);
	
	getCheckBoxCustType("#custType");
	getCheckBoxServiceInfo("#intentionService");
	
	$('.submit span').on('click',function(){
		
		if($('#mobile').val()=='' || $('#email1').val()==''){
			parent.layer.msg('手机、邮箱必须填写');
			return false;
		}
		
		$(this).css('pointer-events','none').css('opacity','0.2');
		var intentionServiceStr;
		if($('#intentionService').val()){
			intentionServiceStr = $('#intentionService').val().join();
		}else{
			intentionServiceStr = '';
		}
		
		var custTypeStr;
		if($('#custType').val()){
			custTypeStr = $('#custType').val().join();
		}else{
			custTypeStr = '';
		}
		var noticeArrayData = $.extend({},{'intentionServiceStr': intentionServiceStr, 'custTypeStr': custTypeStr},$('#memberForm').serializeObject());
		$.ajax({
			url : webroot+ "/member/insertMemberInfo.ajax",
			data : noticeArrayData,
			type : 'POST',
			dataType : 'json',
			success : function(dataResult) {
				parent.layer.msg(dataResult.msg);
				$('.submit span').css('pointer-events','auto').css('opacity','1');
				if(dataResult.type=='2'){
					parent.memberTable().draw();
					parent.layer.close(index);
				}
			}
		});
	});
	
});


